#ifndef PROTOCOLS_ROCE_RECEIVER_MANAGER_H_
#define PROTOCOLS_ROCE_RECEIVER_MANAGER_H_


#include <queue>
#include <stdint.h>
#include <vector>
#include <memory>
#include "cluster/basic/ai_sim.h"

namespace ai_sim {

class RoceReceiverManager {
public:
  RoceReceiverManager();
  // return 1 ACK, 2 NACK
  int processReceivedPacket(uint32_t seqNum, bool isLastSegment, const ai_sim::Flow& flow);
  uint32_t getAckSeqNum();
  bool hasFinishedFlow();
  Flow getFinishedFlow();

private:
  std::queue<Flow> finishedFlows;
  uint32_t expectedSeq;
  int currentFlowId = -1;
  int cummulativeFlowSize = 0;
};

}

#endif